
from ppadb.client import Client as AdbClient



def connect_emulator():
    client = AdbClient(host="127.0.0.1", port=5037)
    client.remote_connect("127.0.0.1", 16384)  #
    return client




if __name__ == '__main__':
    client = connect_emulator()
    devices = client.devices()

    if not devices:
        print("没有找到连接的设备")
        exit()

    # 打印所有设备信息
    print("可用设备:")
    for i, device in enumerate(devices):
        print(f"{i}: {device.serial}")
